#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

void test_fullDeckCount() {
        int player = 0;
        int card = smithy;
        struct gameState* state = newGame();

        state->deckCount[player] = 4;
        state->handCount[player] = 3;
        state->discardCount[player] = 2;

        //smithy only in deck

        state->deck[player][0] = copper;
        state->deck[player][1] = copper;
        state->deck[player][2] = smithy;
        state->deck[player][3] = copper;

        state->hand[player][0] = copper;
        state->hand[player][1] = copper;
        state->hand[player][2] = copper;

        state->discard[player][0] = copper;
        state->discard[player][1] = copper;

        if (fullDeckCount(player, card, state) == 1) {
                printf("fullDeckCount(): PASS when test has only 1 smithy in deck\n");
        }
        else {
                printf("fullDeckCount(): FAIL when test has only 1 smithy in deck\n");
        }

        //smithy only in hand
        
        state->deck[player][0] = copper;
        state->deck[player][1] = copper;
        state->deck[player][2] = copper;
        state->deck[player][3] = copper;

        state->hand[player][0] = smithy;
        state->hand[player][1] = copper;
        state->hand[player][2] = copper;

        state->discard[player][0] = copper;
        state->discard[player][1] = copper;

        if (fullDeckCount(player, card, state) == 1) {
                printf("fullDeckCount(): PASS when test has only 1 smithy in hand\n");
        }
        else {
                printf("fullDeckCount(): FAIL when test has only 1 smithy in hand\n");
        }

        //smithy only in discard

        state->deck[player][0] = copper;
        state->deck[player][1] = copper;
        state->deck[player][2] = copper;
        state->deck[player][3] = copper;

        state->hand[player][0] = copper;
        state->hand[player][1] = copper;
        state->hand[player][2] = copper;

        state->discard[player][0] = copper;
        state->discard[player][1] = smithy;

        if (fullDeckCount(player, card, state) == 1) {
                printf("fullDeckCount(): PASS when test has only 1 smithy in discard\n");
        }
        else {
                printf("fullDeckCount(): FAIL when test has only 1 smithy in discard\n");
        }

        //smithy in each

        state->deck[player][0] = smithy;
        state->deck[player][1] = copper;
        state->deck[player][2] = copper;
        state->deck[player][3] = copper;

        state->hand[player][0] = copper;
        state->hand[player][1] = copper;
        state->hand[player][2] = smithy;

        state->discard[player][0] = copper;
        state->discard[player][1] = smithy;

        if (fullDeckCount(player, card, state) == 3) {
                printf("fullDeckCount(): PASS when test has only 1 smithy in each section\n");
        }
        else {
                printf("fullDeckCount(): FAIL when test has only 1 smithy in each section\n");
        }

        //1 smithy in each but 2 in hand

        state->deck[player][0] = smithy;
        state->deck[player][1] = copper;
        state->deck[player][2] = copper;
        state->deck[player][3] = copper;

        state->hand[player][0] = copper;
        state->hand[player][1] = smithy;
        state->hand[player][2] = smithy;

        state->discard[player][0] = copper;
        state->discard[player][1] = smithy;

        if (fullDeckCount(player, card, state) == 4) {
                printf("fullDeckCount(): PASS when test has only 1 smithy in each section and an extra in hand\n");
        }
        else {
                printf("fullDeckCount(): FAIL when test has only 1 smithy in each section and an extra in hand\n");
        }
}


int main() {
        test_fullDeckCount();
}
